import { defineStore } from "pinia";

export const useUserStore = defineStore("userId",{
    //选项式API写法
    //定义共享数据状态
    state:()=>({
        username:"张三"
    }),
    //计算属性
    getters:{
        formatUser:(state)=>state.username + "今年18岁了"
    },
    //修改数据
    actions:{
        changeUser(){
            this.username = "李四"
        }
    }


})